--使用游标实现加薪操作
declare huhu cursor scroll
for select * from People
open huhu
declare @PeopleId int
fetch first from huhu into @PeopleId
while (@@FETCH_STATUS=0)
	begin
		update People set PeopleSalary+=1000 where PeopleId=@PeopleId
		fetch next from huhu into @PeopleId
	end
close huhu
deallocate huhu
select * from People
--使用游标删除不达标员工
declare huhu cursor scroll
for select * from People
open huhu
declare @id int
fetch first from huhu into @id
while (@@FETCH_STATUS=0)
	begin
		declare @money int=(select PeopleSalary from People where PeopleId=@id)

		if(@money<5000)
		begin
		delete People where PeopleId = @id
		end
		fetch next from huhu into @id
	end
close huhu
deallocate huhu
select * from People
--使用游标 实现:如果A表与B表中ID字段值相同，那么将B表中的省份，城市 修改成与A表中的城市一致（连表）
declare cur_id cursor scroll 
for select A.* from A inner join B on A.id = B.id
open cur_id
declare @id int , @id1 int,@Province varchar(10),@City varchar(10)
fetch first from cur_id into @id,@Province,@City
while(@@FETCH_STATUS = 0)
	begin
			update B set B.Province = @Province , B.City = @City where B.id = @id
			fetch next from cur_id into @id,@Province,@City
	end
		
close cur_id
deallocate cur_id
select * from A
select * from Bt